package cn.modificator.relationtree.mainlist

import android.view.LayoutInflater
import android.view.ViewGroup

import cn.modificator.relationtree.widgets.RecyclerListView
import cn.modificator.relationtree.widgets.RecyclerView
import me.drakeet.multitype.ItemViewBinder

/**
 * Created by Modificator
 * time: 2017/9/18.下午9:11
 * des:create file and achieve model
 */

class MainListItemBinder : ItemViewBinder<MainItem, RecyclerView.ViewHolder>() {

    override fun onCreateViewHolder(inflater: LayoutInflater, parent: ViewGroup): RecyclerView.ViewHolder {
//        return object : RecyclerView.ViewHolder(MainItemCell(inflater.context)) {
//    }
        return RecyclerListView.Holder(MainItemCell(inflater.context))
    }

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, item: MainItem) {
        val mainItemCell = holder.itemView as MainItemCell
        mainItemCell.tvName.text = item.consumerName
        mainItemCell.tvCarType.text = item.carType
        mainItemCell.tvPhoneNum.text = item.consumerPhone
    }
}
